home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
msqc25t1
/
avldrvs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-03
|
899b
|
39 lines
/* AVLDRVS.C illustrates drive functions including:
* _getdrive _chdrive _getdcwd
*
* See DIRECT.C for an example of getcwd.
*
* Modify by Tom Harrold 9/90
*
* This program will print the available drives on the screen. No user
* interaction required. Just run it!
*/
#include <stdio.h>
#include <direct.h>
#include <stdlib.h>
#include <conio.h>
void main()
{
int drive, curdrive;
static char path[_MAX_PATH];
/* Save current drive. */
curdrive = _getdrive();
printf( "Available drives are: \n" );
/* If we can switch to the drive, it exists. */
for( drive = 1; drive <= 26; drive++ )
if( !_chdrive( drive ) )
printf( "%c: ", drive + 'A' - 1 );
/* Restore original drive. This is only necessary for DOS. Under OS/2,
* the current drive of the calling process is always restored.
*/
_chdrive( curdrive );
}